<template>
	<!-- D:/project/app/ydz-app-uniapp/static/images/mine -->
	<view class="pagebody" :style="{ minheight: maxHeight }">
		<view class="headbox" style="background-color: #F0F6F5;">
			<view class=" justify-end" style="padding: 0 40rpx;">
				<image @click="topage('set')" src="../../static/images/mine/setimg.png" style="width: 48rpx;height: 48rpx;margin-top: 69rpx;"
					mode=""></image>
			</view>
			<view class="flex-row align-center justify-between" style="margin-top: 34rpx;padding: 0 40rpx;">
				<view class="align-center">
					<img :src="avatar"
						style="width: 98rpx;height: 98rpx;border-radius: 50%;box-shadow: 0px 0px 16rpx 0rpx rgba(0,200,164,0.3);border: 6rpx solid #fff;"
						alt="" />
					<view class="ml16">
						<view class="color303b39 fz40 fwbold">
							{{user.nickName?user.nickName:user.phonenumber}}
						</view>
						<view class="mt16" style="color: #576260;font-size: 28rpx;">
							<span style="color: #7E8987;">账号：</span>{{user.phonenumber}}
						</view>
					</view>
				</view>
				<view class="signin align-center justify-center" @click="signinShow = true" style="">
					{{istodaysign?'已签到':'签到'}}
				</view>
			</view>
			<view class=" mt16 flex-row justify-between" style="padding: 0 48rpx;">
				<view class="" @click="topage('tz')">
					<image src="../../static/images/mine/tzimg.png" style="width: 148rpx;height: 148rpx;" mode="">
					</image>
					<view class=" text-al-center color303b39 fwbold fz28">
						帖子
					</view>
				</view>
				<view class="" @click="topage('pl')">
					<image src="../../static/images/mine/plimg.png" style="width: 148rpx;height: 148rpx;" mode="">
					</image>
					<view class="text-al-center color303b39 fwbold fz28">
						评论
					</view>
				</view>
				<view class="" @click="topage('dz')">
					<image src="../../static/images/mine/dzimg.png" style="width: 148rpx;height: 148rpx;" mode="">
					</image>
					<view class="text-al-center color303b39 fwbold fz28">
						点赞
					</view>
				</view>
				<view class="" @click="topage('sc')">
					<image src="../../static/images/mine/scimg.png" style="width: 148rpx;height: 148rpx;" mode="">
					</image>
					<view class="text-al-center color303b39 fwbold fz28">
						收藏
					</view>
				</view>
			</view>
			<view class="" style="padding: 0 24rpx;">
				<view class="bgfff mt40" style="padding: 24rpx; border-radius: 40rpx;">
					<view @click="topage('jbxx')" class=" align-center justify-between" style="padding: 40rpx 24rpx;">
						<view class=" align-center">
							<image src="../../static/images/mine/jbxx.png"
								style="width: 40rpx;height: 36rpx;margin-right: 8rpx;" mode=""></image>
							<span class="color303b39 fz36 ">基本信息</span>
						</view>
						<image src="../../static/images/mine/rightimg.png" style="width: 12rpx;height: 22rpx;" mode="">
						</image>
					</view>
					<view @click="topage('yytx')" class=" align-center justify-between" style="padding: 40rpx 24rpx;">
						<view class=" align-center">
							<image src="../../static/images/mine/yytx.png"
								style="width: 40rpx;height: 36rpx;margin-right: 8rpx;" mode=""></image>
							<span class="color303b39 fz36 ">用药提醒</span>
						</view>
						<image src="../../static/images/mine/rightimg.png" style="width: 12rpx;height: 22rpx;" mode="">
						</image>
					</view>
					<view @click="topage('bdsj')" class=" align-center justify-between" style="padding: 40rpx 24rpx;">
						<view class=" align-center">
							<image src="../../static/images/mine/bdsj.png"
								style="width: 40rpx;height: 36rpx;margin-right: 8rpx;" mode=""></image>
							<span class="color303b39 fz36 ">绑定手机</span>
						</view>
						<image src="../../static/images/mine/rightimg.png" style="width: 12rpx;height: 22rpx;" mode="">
						</image>
					</view>
				</view>
			</view>
		</view>
		<view class="" style="padding: 0 24rpx; margin-top: 16rpx;">
			<view class="bgfff mt40" style="padding: 24rpx; border-radius: 40rpx;">
				<view class=" align-center justify-between" style="padding: 40rpx 24rpx;" @click="topage('gywm')">
					<view class=" align-center">
						<image src="../../static/images/mine/gywm.png"
							style="width: 40rpx;height: 36rpx;margin-right: 8rpx;" mode=""></image>
						<span class="color303b39 fz36 ">关于我们</span>
					</view>
					<image src="../../static/images/mine/rightimg.png" style="width: 12rpx;height: 22rpx;" mode="">
					</image>
				</view>
				<view @click="topage('xgmm')" class=" align-center justify-between" style="padding: 40rpx 24rpx;">
					<view class=" align-center">
						<image src="../../static/images/mine/xgmm.png"
							style="width: 40rpx;height: 36rpx;margin-right: 8rpx;" mode=""></image>
						<span class="color303b39 fz36 ">修改密码</span>
					</view>
					<image src="../../static/images/mine/rightimg.png" style="width: 12rpx;height: 22rpx;" mode="">
					</image>
				</view>

			</view>
		</view>
		<u-popup v-model="signinShow"  mode="center">
			<view class="qdbox pos-rel ofhide">
				<view class="fz24" style="color: #fff;margin-top: 199rpx;margin-left: 93rpx;">
					积分签到，开启你的积分之旅!
				</view>
				<view class=" flex-col justify-between"
					style="width: 570rpx;height: 500rpx;  margin-left: 75rpx;margin-top: 56rpx;">
					<view class="justify-between" style="height: 235rpx; ">
						<view class="br16 flex-col align-center" :class="signinarr.indexOf(1)!=-1?'istrue':'isfalse'"
							style="width: 134rpx;height: 235rpx;">
							<view class="textcolor fz32 fwbold mt16 justify-center" style="">+15</view>
							<image
								:src="signinarr.indexOf(1)!=-1?'../../static/images/mine/isqd.png':'../../static/images/mine/noqd.png'"
								style="width: 98rpx;height: 112rpx;" mode="">
							</image>
							<view class="fz24" style="color: #7E8987;margin-top: 8rpx;">
								星期一
							</view>
						</view>
						<view class="br16 flex-col align-center" :class="signinarr.indexOf(2)!=-1?'istrue':'isfalse'"
							style="width: 134rpx;height: 235rpx;">
							<view class="textcolor fz32 fwbold mt16 justify-center" style="">+15</view>
							<image
								:src="signinarr.indexOf(2)!=-1?'../../static/images/mine/isqd.png':'../../static/images/mine/noqd.png'  "
								style="width: 98rpx;height: 112rpx;" mode="">
							</image>
							<view class="fz24" style="color: #7E8987;margin-top: 8rpx;">
								星期二
							</view>
						</view>
						<view class="br16 flex-col align-center" :class="signinarr.indexOf(3)!=-1?'istrue':'isfalse'"
							style="width: 134rpx;height: 235rpx;">
							<view class="textcolor fz32 fwbold mt16 justify-center" style="">+15</view>
							<image
								:src="signinarr.indexOf(3)!=-1?'../../static/images/mine/isqd.png':'../../static/images/mine/noqd.png'"
								style="width: 98rpx;height: 112rpx;" mode="">
							</image>
							<view class="fz24" style="color: #7E8987;margin-top: 8rpx;">
								星期三
							</view>
						</view>
						<view class="br16 flex-col align-center" :class="signinarr.indexOf(4)!=-1?'istrue':'isfalse'"
							style="width: 134rpx;height: 235rpx;">
							<view class="textcolor fz32 fwbold mt16 justify-center" style="">+15</view>
							<image
								:src="signinarr.indexOf(4)!=-1?'../../static/images/mine/isqd.png':'../../static/images/mine/noqd.png'"
								style="width: 98rpx;height: 112rpx;" mode="">
							</image>
							<view class="fz24" style="color: #7E8987;margin-top: 8rpx;">
								星期四
							</view>
						</view>

					</view>
					<view class="justify-between" style="height: 235rpx;">
						<view class="br16 flex-col align-center" :class="signinarr.indexOf(5)!=-1?'istrue':'isfalse'"
							style="width: 134rpx;height: 235rpx;">
							<view class="textcolor fz32 fwbold mt16 justify-center" style="">+15</view>
							<image
								:src="signinarr.indexOf(5)!=-1?'../../static/images/mine/isqd.png':'../../static/images/mine/noqd.png'"
								style="width: 98rpx;height: 112rpx;" mode="">
							</image>
							<view class="fz24" style="color: #7E8987;margin-top: 8rpx;">
								星期五
							</view>
						</view>
						<view class="br16 flex-col align-center" :class="signinarr.indexOf(6)!=-1?'istrue':'isfalse'"
							style="width: 134rpx;height: 235rpx;">
							<view class="textcolor fz32 fwbold mt16 justify-center" style="">+15</view>
							<image
								:src="signinarr.indexOf(6)!=-1?'../../static/images/mine/isqd.png':'../../static/images/mine/noqd.png'"
								style="width: 98rpx;height: 112rpx;" mode="">
							</image>
							<view class="fz24" style="color: #7E8987;margin-top: 8rpx;">
								星期六
							</view>
						</view>
						<view class="br16 flex-col align-center"
							style="width: 284rpx;height: 235rpx;background: #F5F5F5;">
							<view class="textcolor fz32 fwbold mt16 justify-center" style="">+15</view>
							<image
								:src="signinarr.indexOf(7)!=-1?'../../static/images/mine/isqd.png':'../../static/images/mine/noqd.png'"
								style="width: 98rpx;height: 112rpx;" mode="">
							</image>
							<view class="fz24" style="color: #7E8987;margin-top: 8rpx;">
								星期日
							</view>
						</view>
					</view>
				</view>
				<view class=" justify-center ">
					<image @click="signin" src="../../static/images/mine/qdbtn.png"
						style="width: 408rpx;height: 140rpx; margin-top: 50rpx;" mode=""></image>
				</view>
				<!-- <image class="" src="../../static/images/mine/closeimg.png" style="position: absolute;width: 82rpx;height: 82rpx;margin-top: 20px;" mode=""></image> -->

			</view>
		</u-popup>


		<FixedFoot :typeid="4"></FixedFoot>
		<u-toast ref="uToast" />


	</view>
</template>

<script>
	
	import {
		signIn
	} from '@/api/api.js'
	import {
		getInfo
	} from '@/api/login'
	import store from "@/store"
	// import { element } from 'prop-types';
	import FixedFoot from '../../layouts/fixedfoot.vue';
	import TopSearch from '../../layouts/topsearch.vue';
	export default {
		components: {
			FixedFoot,
			TopSearch
		},
		onLoad() {
			// 获得屏幕最大高度
			let systemInfo = uni.getSystemInfoSync();
			this.maxHeight = systemInfo.windowHeight + "px";
		},
		onShow() {
			this.getuser()
		},
		data() {
			return {
				maxHeight: '',
				placeholderStyle: "color:#7E8987;font-size:32rpx",
				avatar: store.getters.avatar,
				user: {},
				signinShow: false,
				istodaysign:false,
				signinarr: [],
				routerobj: {
				  tz: 'myPost',
				  pl: 'myComment',
				  sc: 'myCollect',
				  dz: 'myLike',
				  jbxx: 'information',
				  bdsj: 'bindphone',
				  xgmm: 'updatePassword',
				  yytx: 'usedruglist',
				  gywm: 'aboutus',
				  set: 'setting'
				},

			}
		},
		methods: {
			getuser() {
				getInfo().then(res => {
					this.signinarr = []
					this.user = res.user
					this.istodaysign = res.signIn
					let arr = res.signInRecord
					if(arr.length){
						arr.forEach(item=>{
							this.signinarr.push(item.week)
						})
					}
				})
				// 刷新头像
				this.avatar = store.getters.avatar
			},
			signin() {
				signIn().then(res => {
					this.$refs.uToast.show({
						title: res.msg,
						// type: 'success',
					})
					this.getuser()
					this.signinShow = false
				})
			},
			topage(name) {
				const BASE_PATH = '/pages/mine/';
				 let route = this.routerobj[name];
				  if (route) {
				    uni.navigateTo({ url: `${BASE_PATH}${route}` });
				  }

			}


		}
	};
</script>

<style lang="scss" scoped>
	::v-deep .is-input-border {
		border: none;
	}

	::v-deep uni-swiper {
		margin-top: 68rpx;
		height: 180rpx !important;
		padding: 0 28rpx;
	}

	::v-deep uni-swiper .uni-swiper-dot {
		width: 8rpx;
		height: 8rpx;
		background-color: #E8EBEB;
	}

	::v-deep uni-swiper .uni-swiper-dot-active {
		background-color: #00D9B2;
	}

	::v-deep .uni-easyinput__content {
		background: transparent !important;
	}

	::v-deep .uni-input-input {
		font-size: 32rpx;
	}

	::v-deep uni-checkbox .uni-checkbox-input {
		background: transparent;
	}

	::v-deep uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
		color: #fff;
		border-color: #00D9B2;
		background: #00D9B2;
	}

	::v-deep .uni-icons {
		font-size: 52rpx !important;
	}

	::v-deep uni-toast {
		font-size: 24rpx;
	}

	::v-deep .input-placeholder {
		font-size: 28rpx;
		color: #B8C3C1 !important;
	}

	::v-deep .u-mode-center-box {
		background: transparent;
	}


	.pagebody {
		box-sizing: border-box;
		padding-bottom: 98rpx;

		.headbox {
			background-image: url('/static/images/mine/minebg.png');
			position: relative;
			background-repeat: no-repeat;
			background-size: cover;
			border-radius: 0 0 24rpx 24rpx;

			.signin {
				width: 136rpx;
				height: 60rpx;
				background: linear-gradient(90deg, #FFFAE9 0%, #FFE99E 100%);
				border-radius: 60rpx;
				font-weight: bold;
				color: #FD6F23;
			}
		}

		.qdbox {
			width: 720rpx;
			height: 1078rpx;
			background-image: url('/static/images/mine/qdbg.png');
			background-repeat: no-repeat;
			background-size: cover;

			.istrue {
				background: linear-gradient(180deg, #FFE5E5 0%, #FFFFFF 100%);
			}

			.isfalse {
				background: #F5F5F5;
			}

			.textcolor {
				background-image: linear-gradient(266.5317717300374deg, #FC1C12 0%, #FD6F23 100%);
				background-clip: text;
				-webkit-background-clip: text;
				-webkit-text-fill-color: transparent;
			}
		}


	}
</style>